<div class="form wide">

<?php $form=$this->beginWidget('FActiveForm', array(
	'id'=>'category-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

    <?php if (! $model->IsNewRecord) echo $form->hiddenField($model, "id") ; ?>
    <?php $form->hiddenField($model, "ordering"); ?>
    <?php //$form->hiddenField($model, "parent_id"); ?>
    <div class="row">
        <?php echo $form->labelEx($model,'parent_id'); ?>
        <?php $this->widget('CategoryDropDownList', array(
            'model'=>$model,
            'attribute'=>'parent_id',
            'htmlOptions'=>array(
                'prompt'=>'Root',
            ),
            'exclude'=>array($model->id),
//            'enableCache'=>true,
        )); ?>
        <?php echo $form->error($model,'parent_id'); ?>
    </div>
    
	<div class="row">
		<?php echo $form->labelEx($model,'title'); ?>
		<?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'title'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'alias'); ?>
		<?php echo $form->textField($model,'alias',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'alias'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'description'); ?>
		<?php echo $form->textArea($model,'description',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'description'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'image'); ?>
		<?php echo $form->textField($model,'image',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'image'); ?>
	</div>

    <div class="row">
        <?php echo $form->labelEx($model,'is_active', array('label'=>'Visible')); ?>
        <?php echo $form->checkBox($model,'is_active'); ?>
        <?php echo $form->error($model,'is_active'); ?>
    </div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->